<template>
    <div>
      <mt-header fixed title="新闻详情">
        <router-link to="/" slot="left">
          <mt-button icon="back" @click="$router.back(-1)">返回</mt-button>
        </router-link>
      </mt-header>
      <div class="art-box" v-html="contents"></div>
    </div>
</template>

<script>
export default {
  name: 'NewsPage',
  data () {
    return {
      contents:''
    }
  },
  created(){
    let news_id = this.$route.query.news_id;  //接受参数关键代码
    this.requestData(news_id);
  },
  methods:{
    requestData(news_id){
      this.$axios.get('getNewsPage',{
        params: {
          news_id: this.news_id,
          pageNum:20
        }
      })
      .then(res=>{
        console.log(res);
        this.contents=res.data.data.contents;
      })
      .catch(err=>{
        console.log(err);
      });
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style>
  .art-box{
    margin-top: 40px;
  }
  .art-box{
    padding: 10px;
  }
  .art-box img{
    width: 100% !important;
    height: auto;
  }

</style>
